﻿using System.Collections.Generic;

namespace S7PlcDataCollector.Service.SQLiteProxy.Bll
{
    internal class S7PlcVariableEntity
    {
        private readonly Dal.S7PlcVariableEntity _dal = new Dal.S7PlcVariableEntity();

        /// <summary>
        /// 添加PLC变量实体
        /// </summary>
        /// <param name="model">PLC变量实体对象</param>
        /// <returns>Rid</returns>
        public int Add(Models.S7PlcVariableEntity model)
        {
            return _dal.Insert(model);
        }

        /// <summary>
        /// 批量添加PLC变量实体
        /// </summary>
        /// <param name="models">PLC变量实体对象集合</param>
        /// <returns>true成功，false失败</returns>
        public bool Add(List<Models.S7PlcVariableEntity> models)
        {
            return _dal.Insert(models);
        }

        /// <summary>
        /// 更新PLC变量实体
        /// </summary>
        /// <param name="model">PLC变量实体对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Update(Models.S7PlcVariableEntity model)
        {
            return _dal.Update(model);
        }

        /// <summary>
        /// 删除PLC变量实体
        /// </summary>
        /// <param name="model">PLC变量实体对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Delete(Models.S7PlcVariableEntity model)
        {
            return _dal.Delete(model);
        }

        /// <summary>
        /// 查询PLC变量实体
        /// </summary>
        /// <param name="rid">PLC变量实体id</param>
        /// <returns>PLC变量实体对象</returns>
        public Models.S7PlcVariableEntity GetModel(int rid)
        {
            return _dal.GetModel(rid);
        }

        /// <summary>
        /// 查询PLC变量实体集合
        /// </summary>
        /// <param name="s7PlcEntityRid">PLC实体Id</param>
        /// <returns>PLC变量实体集合</returns>
        public List<Models.S7PlcVariableEntity> GetModels(int s7PlcEntityRid)
        {
            return _dal.GetModels(s7PlcEntityRid);
        }

        /// <summary>
        /// 查询所有PLC变量实体
        /// </summary>
        /// <returns>PLC变量实体对象集合</returns>
        public List<Models.S7PlcVariableEntity> GetAllModels()
        {
            return _dal.GetAllModels();
        }
    }
}
